
import { MongooseFactory } from "../kalend";
import { Schema } from "mongoose";

/** 酒币消费记录 */
const schema = MongooseFactory.Schema({
    openid: {
        type: String
    },
    // 用户id
    userid: {
        type: Schema.Types.ObjectId,
        ref: "customer_account"
    },
    // 用户id
    upuser: {
        type: Schema.Types.ObjectId,
        ref: "platform_user"
    },
    // 商户
    merchantid: {
        type: Schema.Types.ObjectId,
        ref: "merchant"
    },
    // 用户酒币余额
    coinbalance: {
        type: Number,
        default: 0
    },
    // 消费酒币
    conins: {
        type: Number,
        default: 0
    },
    // 消费前酒币数量
    originwine: {
        type: Number,
        default: 0
    },
    // 消费来源 如：1:消费、2:升级会员、3:邀请奖励、4:活动奖励 5.后台修改 6.升级白金会员 7.升级钻石会员
    source: {
        type: Number,
        default: 1
    },
    orderid: {
        type: Schema.Types.ObjectId,
        ref: "customer_order"
    },
    //备注
    remark: {
        type: String
    },
    // 是否未找到用户新增
    isaddnew: {
        type: Boolean,
        default: false
    }
});



export const wineModel = MongooseFactory.Model("wine", schema);